<?php
 	$list_friend = $this->fmk_list;
// 	print_r($list_friend[0]);
 	$action = $this->action;
 	$isfriend = $this->isfriend_arr;
 	$info_username = $this->info_username;
 	$dm = $this->dm;
 ?>
 <br />
<table width=669px>
	<tr>
		<td width=65%>
			<input size=40px id="search" />
			<button class="login_button" onclick="search()">search friend</button> 
		</td>
		<td width=10% align=right>
			<a href="/<?php echo $info_username['username']?>/friend" style="text-decoration:none">
				<div class="f_node <?php if ($action=='index') echo 'f_selected'?>">Friends</div>
			</a>
		</td>
		<?php if ($this->info_username['id']==$this->info_viewer['id']){?>
		<td width=25% align=right>
			<a href="/<?php echo $info_username['username']?>/friend/fmk" style="text-decoration:none">
			<div class="f_node <?php if ($action=='fmk') echo 'f_selected'?>">People you may know</div>
			</a>
		</td>
		<?php }?>
	</tr>
</table>
<div class="friend_list">
	<?php
		Zend_Loader::loadClass('UserModel'); 
		foreach ($dm as $friend){
			$info = UserModel::getuserinfoID($friend['id']);
	?>
		<table>
		<tr>
		<td style="background:url('/images/friend-box.png')">
		<div class="friend_box">
			<table width=100%>
			<tr>
				<td height=100px style="background-image:url('/images/round.png')">
				<div  align="center">
					<?php 
					$img_path = IMAGE_PATH.'/avatar/'.$info['avatar'];
    					$size = @getimagesize($img_path);
    					if ($size[0]>$size[1]) $att='width';
    					else $att = 'height';
    				?>
    				<img src='/images/avatar/<?php echo $info['avatar']?>' <?php echo $att?>=100px />
    			</div>
    			</td>
			</tr>
			<tr>
				<td>
				<div align=center style="font-family:arial;font-size:15px;color:orange">
					<a href="/<?php echo $info['username']?>" style="text-decoration:none;color:orange"><b><?php echo $info['fullname']?></b></a>
				</div>
				</td>
			</tr>
			</table>
		</div>
		</td>
		<td style="background:url('/images/friend-box.png');padding-left: 20px;font-size:15px;" width=200px >
			<p>Have <?php echo $friend['mutual']?> mutual friend(s)</p>
			<p>Same hobbies:</p>
			<ul>
				<li>Music: <?php echo $friend['hobby']['music']?></li>
				<li>Sport: <?php echo $friend['hobby']['sport']?></li>
			</ul>
		</td>
		</tr>
		</table>
	<?php }?>
</div>
